<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 transitional//EN">
<html>
<head>
<title>Script Data Set Element</title>
<link rel="stylesheet" href="../style/style.css" type="text/css"/>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<h1>ScriptDataSet</h1>

<p>A data set defined in JavaScript.</p>

<h3>Description</h3>

<p>Represents a data set defined in JavaScript code, 
providing methods for opening, fetching and closing the data set. It defines 
the overall properties of the scripted data set including the JavaScript methods 
themselves and an optional result set definition.</p>

<h3>See Also</h3>
<p><code>Script Data Source element</code></p>
<p><code>DataSet</code> scripting object</p>

<h3>See Also</h3>
<h2 class="property">dataSource</h2>

<p>The database connection that the data set is used.</p>

<h3>Description</h3>

<p>Name of the data source, that is the database connection this data set is using.</p>

<h3>See Also</h3>
<p><code>DataSetParam structure</code></p>
<p><code>ParamBinding structure</code></p>
<h2 class="method">open</h2>
<p>Opens the data set.</p>

<h3>Description</h3>

<p>Opens the external data set. Throws a JavaScript 
exception if the open fails. Often refers to report parameters or user-defined 
parameters for information about the data set. Optional.</p>

<h3>See Also</h3>
<p><code>beforeOpen</code> method</p>
<p><code>afterOpen</code> method</p>

<h2 class="method">describe</h2>

<p>Dynamically describes the result set definition in JavaScript.</p>

<h3>Return</h3>

<p>The Describe method can return null, which tells BIRT to use the static 
definition instead. The script can access the static description using the 
design object within the script.</p>

<p>If the method returns a column array, then the array must satisfy the 
following constraints:</p>

<ul>
  <li>The array must have at least two entries,</li>
  <li>The entry in position 0 (which represents the row number column) is 
  ignored.</li>
  <li>The entry in position 1 must exist.</li>
  <li>There must be no empty positions in the array.</li>
  <li>Each position must contain an object of type ResultSetColumn.</li>
  <li>The column names must be unique within the result set definition.</li>
  <li>Each column definition in the array must have a one-to-one match with the 
  corresponding column in the DataRow object returned by the fetch method.</li>
</ul>

<h3>Description</h3>

<p>Called before BIRT calls the
<code>beforeOpen</code> method. Creates a 
runt-time definition of the result set columns. Returns an array of 
ResultSetColumn objects. Each object describes a column in the expected result 
set. Optional.</p>

<h3>See Also</h3>
<p><code>ResultSetColumn</code> structure</p>

<h2 class="method">fetch</h2>

<p>Fetches a row from the data set.</p>

<h3>Return</h3>

<p>Returns <code>true</code> if there is another row to fetch, <code>false</code> if there are no more 
rows. When the data set has returned the last row from the result set, 
subsequent calls to
<code>fetch</code> should return <code>false</code>. </p>

<h3>Description</h3>

<p>Fetches a row from the data set on each call, and populates the current row 
available in the <code>row</code> property.</p>

<h3>See Also</h3>
<p><code>onFetch</code> method</p>
<p><code>DataRow scripting object</code></p>

<h2 class="method">close</h2>

<p>Called by BIRT to close the data set.</p>

<h3>Description</h3>

<p>Closes the data set. Optional.</p>

<h3>See Also</h3>
<p><code>beforeClose</code> method</p>
<p><code>afterClose</code> method</p>

</body>
</html>